<?php
namespace app\controller\api\v1\housing;

use app\Request;
class HousingMetroStation
{

	//城市地铁线列表
	public function metrostation_list  (Request $request)
	{
		$model = new \app\model\v1\housing\HousingMetroStation();


		[$name] = $request->postMore ([['name','']],true);

			$line_name = $model->where ('name',$name)->group ('line_name')->field ('line_name,line_identifier')->order ('id')->select()->toArray ();
			$datas=[];
			foreach ($line_name  as $vv){
				$vv['station']=$model->where ('line_identifier',$vv['line_identifier'])->where ('is_delete',0)->where ('enable_status',0)->group ('station')->field ('id,station')->order ('id')->select()->toArray ();
				$datas[] = $vv;
			}

			return app('json')->success ($datas);
	}




	//全国地铁城市
	public function city_list ()
	{
		$model = new \app\model\v1\housing\HousingMetroStation();

		$housing_collection = $model->group ('name')->field ('name')->order ('id')->select()->toArray ();
		return app('json')->success ($housing_collection);

	}

}
